#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 1e5 + 10;
int a[N], son[31 * N][2];
int n, ans, idx;

void insert(int x)
{
    int p = 0;
    for (int i = 30; i >= 0; i--)
    {
        int u = x >> i & 1;
        if (!son[p][u])son[p][u] = ++idx;
        p = son[p][u];
    }
}

int search(int x)
{
    int p = 0, res = 0;
    for (int i = 30; i >= 0; i--)
    {
        int u = x >> i & 1;
        if (son[p][!u])
        {
            res = res * 2 + !u;
            p = son[p][!u];
        }
        else
        {
            res = res * 2 + u;
            p = son[p][u];
        }
    }
    return res;
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)cin >> a[i], insert(a[i]);
    for (int i = 0; i < n; i++)ans = max(ans, a[i] ^ search(a[i]));
    cout << ans;
    return 0;
}